﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using VoL.Domain.Infrastructure;
using VoL.Domain.IServices.WorkforceManage;
using VOL.Entity.DomainModels;

namespace VoL.Domain.Services.WorkforceManage
{
    public class NurseGroupService : INurseGroupService
    {
        /// <summary>
        /// 人员分组服务
        /// </summary>
        private readonly IBaseRepository<NurseGroup> _nurseGroupRepository;

        /// <summary>
        /// 构造方法
        /// </summary>
        /// <param name="nurseGroupRepository">人员分组</param>
        public NurseGroupService(IBaseRepository<NurseGroup> nurseGroupRepository)
        {
            this._nurseGroupRepository = nurseGroupRepository;
        }
        /// <summary>
        /// 添加
        /// </summary>
        /// <param name="nurseGroup">实体</param>
        /// <returns>返回受影响的行数</returns>
        public async Task<int> AddNurseGroup(NurseGroup nurseGroup)
        {
            var  result = _nurseGroupRepository.Add(nurseGroup);
            return await result;
        }
        /// <summary>
        /// 删除
        /// </summary>
        /// <param name="nurseGroup">实体</param>
        /// <returns>返回受影响的行数</returns>
        public async Task<int> DeleteNurseGroup(NurseGroup nurseGroup)
        {
            var result = _nurseGroupRepository.Delete(nurseGroup);
            return await result;
        }
        /// <summary>
        /// 显示
        /// </summary>
        /// <returns>返回任务</returns>
        public IQueryable<NurseGroup> GetAllNurseGroups()
        {
            var nursegrouplist = _nurseGroupRepository.GetAll();
            return nursegrouplist;
        }
        /// <summary>
        /// 更新
        /// </summary>
        /// <param name="nurseGroup">实体</param>
        /// <returns>返回受影响的行数</returns>
        public async Task<int> UpdateNurseGroup(NurseGroup nurseGroup)
        {
            var result = _nurseGroupRepository.Update(nurseGroup);
            return await result;
        }
    }
}
